<!--
 * @Descripttion: 
 * @Version: 
 * @Author: gaohj
 * @Date: 2022-10-31 15:03:22
 * @LastEditors: Please set LastEditors
 * @LastEditTime: 2022-10-31 15:09:01
-->
<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>
<body>
    <script>
         // 红球 1-33 6个  不能重复  还要排序  
        // var red = Math.floor(Math.random()*33+1);
        // console.log(red);
        // 蓝色 1-16 1个 
        // var blue = Math.floor(Math.random()*16+1);
        var redballs = [];
        for(var i=0;i<6;i++){
            var red = Math.floor(Math.random()*33+1);
            if(redballs.indexOf(red) == -1){
                redballs.push(red);
            }else{
                i--;
            }
        }

        redballs.sort(function(a,b){return a-b});

        var blue = Math.floor(Math.random()*16+1);
        redballs.push(blue);

        console.log(redballs);

    </script>
</body>
</html>